<?php
	include "../php/HeaderBlock.php";
	include "../php/FooterBlock.php";
	$header = &New HeaderBlock;
	$footer = &New FooterBlock;
	$header->highlighted="events";
	$header->print_head();
?>
<div class="content">
<h2>OARC events</h2>
<div class="addr">
OARC,<br />
Room One, <br />
East Oxford Community Centre (EOCC),<br />
Princes St (off Cowley Road)<br />
</div>
<br />
<div style="margin:0 15%; text-align:center">
<?php

$username="calendar";
$password="pw4sn6";
$database="events";

mysql_connect("localhost",$username,$password) or die( "Unable to connect");
@mysql_select_db($database) or die( "Unable to select database");

$query="SELECT * FROM events WHERE date >= '" . date("Y-m-d") . "' ORDER BY date, time";
$result=mysql_query($query);
$n=mysql_num_rows($result);

mysql_close();

if ($n != 0) { 
  echo '<table style="margin:10px 1em;width:100%" summary="OARC upcoming events">
  <caption>Upcoming events at OARC <a href="rss.php"><img style="border:none" src="/graphics/rss.gif" alt="RSS" /></a></caption>
  <tr><th>Date / Time</th><th>Event</th></tr>';
  $i=0;
  while ( ($i < $n) && ($i < 15) ) {
    $number=mysql_result($result,$i,"number");
    $date=mysql_result($result,$i,"date");
    $time=mysql_result($result,$i,"time");
    $endtime=mysql_result($result,$i,"endtime");
    $title=mysql_result($result,$i,"title");
    $keyholder=mysql_result($result,$i,"keyholder");

    echo "<tr><td class=\"r\">" . date("l jS F - g:ia",strtotime($date . " " . $time));
    if ($endtime != "00:00:00") echo date("-g:ia",strtotime("2005-01-01 " . $endtime));
    echo "</td><td class=\"l\"><a href=\"view.php?id=$number\">$title</a>";
    if (!$keyholder) echo " (unconfirmed)";
    echo "</td></tr>\n";

  $i++;
  }

  echo "</table>";

  if ($n > 15) echo "<a href=\"index_all.php\">Show all $n events</a><br />";

} else echo "<br />There are no events currently in the calendar.<br />";

?>
<a href="book.php" style="font-size:1.5em"> &gt; Book An Event &lt; </a>
<br />
<hr  style="width:70%" />
[<a href="http://openstreetmap.com/?mlat=51.7483&amp;mlon=-1.2377&amp;zoom=16">Where is the EOCC?</a>]<br />
[<a href="http://www.indymedia.org.uk/en/regions/oxford/">Oxford Indymedia</a>]<br />
<hr  style="width:70%" />

<br />

Click refresh to see the latest version of this page.<br />
Click on an event to see more details<br />
[<a href="admin/index.php">Calendar Admin</a>]
</div></div>
<?
$footer->print_foot();
?>
</body>
</html>
